//
//  ActivityTableViewCell.m
//  AoJi
//
//  Created by MinwenYi on 15-1-30.
//  Copyright (c) 2015年 xuanheng. All rights reserved.
//

#import "ActivityTableViewCell.h"

@implementation ActivityTableViewCell
-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self=[super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self otherConfig];
    }
    return self;
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(void)otherConfig
{
    UIImage *baoming= [UIImage imageNamed:@"baiming-but.png"];
   
    self.signUpImgview=[[UIImageView alloc]initWithFrame:CGRectMake(Mainwidth-7-60,10, baoming.size.width/2,baoming.size.height/2)];
    [self addSubview:self.signUpImgview];
    self.signUpImgview.image=baoming;
    self.signUpImgview.userInteractionEnabled=YES;
    
    
    

    self.headImgview=[[UIImageView alloc]initWithFrame:CGRectMake(6,7,92-15, 92-15)];
    [self addSubview:self.headImgview];
    
    self.mainTitle=[[UILabel alloc]initWithFrame:CGRectMake(viewRight(self.headImgview)+6, viewTop(self.headImgview), viewLeft(self.signUpImgview)-viewRight(self.headImgview)-6,20)];
    
    
    
    self.mainTitle.textAlignment=NSTextAlignmentLeft;
    self.mainTitle.font=[UIFont systemFontOfSize:14];
    self.mainTitle.textColor=[self getCorlor:@"343434"];
    [self addSubview:self.mainTitle];

    
    self.cityLabel=[[UILabel alloc]initWithFrame:CGRectMake(viewLeft(self.mainTitle),viewBottom(self.mainTitle), 60, 20)];
    [self addSubview:self.cityLabel];
    
    self.cityLabel.textAlignment=NSTextAlignmentLeft;
    self.cityLabel.font=[UIFont systemFontOfSize:13];
    self.cityLabel.textColor=[self getCorlor:@"b4b3b3"];
    
    
     self.timelabel=[[UILabel alloc]initWithFrame:CGRectMake(viewRight(self.cityLabel),viewTop(self.cityLabel), 140, 20)];
   
    
   
    [self addSubview:self.timelabel];
    self.timelabel.textAlignment=NSTextAlignmentLeft;
    self.timelabel.font=[UIFont systemFontOfSize:15];
    self.timelabel.textColor=[self getCorlor:@"b4b3b3"];
    
    
    self.descriptionLabel=[[UILabel alloc]initWithFrame:CGRectMake(viewLeft(self.mainTitle), viewBottom(self.cityLabel), Mainwidth-viewRight(self.headImgview)-6-7, 40)];
    self.descriptionLabel.numberOfLines=2;
    self.descriptionLabel.textAlignment=NSTextAlignmentLeft;
    self.descriptionLabel.font=[UIFont systemFontOfSize:14];
    [self addSubview:self.descriptionLabel];
    self.descriptionLabel.textColor=[self getCorlor:@"B4B3B3"];
    
    self.signName=[[UIButton alloc]initWithFrame:CGRectZero];
    [self addSubview:self.signName];
//

}
-(void)setParamDic:(NSMutableDictionary *)paramDic
{
    
    
    if (self.cellType==CellTypeInfomation) {
        self.mainTitle.frame=CGRectMake(viewRight(self.headImgview)+6, viewTop(self.headImgview), Mainwidth-viewRight(self.headImgview)-12,20);
        
    }
    
    if (_paramDic!=paramDic) {
        _paramDic=paramDic;
        if (self.cellType==CellTypeInfomation) {
            self.timelabel.text=[self getTime:[self.paramDic objectForKey:@"updatetime"]];
        }else{
        self.timelabel.text=[self getTime:[self.paramDic objectForKey:@"begin_time"]];
        }
        self.mainTitle.text=[self.paramDic objectForKey:@"title"];
        self.descriptionLabel.text=[self.paramDic objectForKey:@"description"];//description
        self.cityLabel.text=[self.paramDic objectForKey:@"city_name"];
        [self.headImgview sd_setImageWithUrlString:[self.paramDic objectForKey:@"thumb"] placeholderImage:[UIImage imageNamed:@"morentouxiang.png"] options:SDWebImageRetryFailed];
        
        
        if (self.cellType==CellTypeInfomation) {
            self.timelabel.frame=CGRectMake(viewLeft(self.mainTitle),viewTop(self.cityLabel), 140, 20);
        }
    }

}


//{
//    "begin_time" = 1422669600;
//    "city_name" = "\U5317\U4eac\U706f\U5e02\U53e3";
//    "company_id" = 10;
//    "country_id" = 6;
//    description = "\U3000\U3000\U8bb2\U5ea7\U5185\U5bb9\Uff1a\U3000\U3000\U65b0\U52a0\U5761\U7684\U5347\U5b66\U6d41\U7a0b\U8ddf\U4e2d\U56fd\U4e5f\U662f\U4e0d\U4e00\U6837\U7684\Uff0c\U4e2d\U5b66\U6bd5\U4e1a\U540e\U5e76";
//    "end_time" = 1422694800;
//    "host_city" = 10;
//    id = 5657;
//    thumb = "";
//    title = "\U9b45\U529b\U65b0\U52a0\U5761\U2014\U2014\U7279\U8272\U5347\U5b66";
//}
//)



@end
